package com.one.dao;

import com.one.entity.Application;
import com.one.utils.DbConn;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class ApplicationDao {
    //增删改查的工具
    private QueryRunner runner = new QueryRunner(DbConn.getDataSource());

    /**
     * 查询所有申请信息
     * @return
     */
    public List<Application> selApplies(){
        List<Application> applies = new ArrayList<>();
        String sql = "select * from application";
        try {
            applies = runner.query(sql, new BeanListHandler<>(Application.class));
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return applies;
    }
}
